BEGIN TRANSACTION
CREATE TABLE dbo.Tmp_c_referido
	(
	id_referido int NOT NULL IDENTITY (57, 1),
	nombre_referido varchar(40) NULL,
	telefono_referido varchar(30) NULL,
	apaterno_referido varchar(30) NULL,
	amaterno_referido varchar(30) NULL,
	id_prospecto int NOT NULL
	)  ON [PRIMARY]
GO
SET IDENTITY_INSERT dbo.Tmp_c_referido ON
GO
IF EXISTS(SELECT * FROM dbo.c_referido)
	 EXEC('INSERT INTO dbo.Tmp_c_referido (id_referido, nombre_referido, telefono_referido, apaterno_referido, amaterno_referido, id_prospecto)
		SELECT id_referido, nombre_referido, telefono_referido, apaterno_referido, amaterno_referido, id_prospecto FROM dbo.c_referido TABLOCKX')
GO
SET IDENTITY_INSERT dbo.Tmp_c_referido OFF
GO
DROP TABLE dbo.c_referido
GO
EXECUTE sp_rename N'dbo.Tmp_c_referido', N'c_referido', 'OBJECT'
GO
COMMIT